package com.ruoyi.blog.controller.api;

import com.ruoyi.blog.domain.BlogLeave;
import com.ruoyi.blog.service.IBlogLeaveService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@RequestMapping("/api/blog/leave")
public class LeaveController extends BaseController {

    @Autowired
    private IBlogLeaveService iBlogLeaveService;

    @PostMapping("sendLeaveInfo")
    public AjaxResult sendLeaveInfo(@RequestBody BlogLeave blogLeave) {
        blogLeave.setCreateTime(new Date());
        blogLeave.setStatus("0");
        iBlogLeaveService.insertBlogLeave(blogLeave);
        return AjaxResult.success();
    }

}
